home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 25
/
Volume 25 - JOGO DISK .iso
/
Games
/
the_jewel_hunter.swf
/
scripts
/
Bike.as
next >
Wrap
Text File
|
2006-06-13
|
2KB
|
75 lines
classBike = function()
{
this.init();
};
classBike.prototype = new MovieClip();
Object.registerClass("Bike",classBike);
classBike.prototype.init = function()
{
thisholder = new Object();
this.mc.gotoAndStop(random(this.mc._totalframes) + 1);
};
classBike.prototype.update = function()
{
var _loc1_ = this;
_loc1_._y -= _loc1_.yspeed;
if(_loc1_._y < -30)
{
_loc1_._parent.bikeCount -= 1;
removeMovieClip(_loc1_);
}
for(var _loc3_ in _loc1_._parent)
{
var _loc2_ = _loc1_._parent[_loc3_];
if(_loc2_._name != _loc1_._name)
{
_loc1_.check(_loc2_);
}
}
};
classBike.prototype.smoke = function()
{
var _loc1_ = this;
if(Game.player.mc._y < _loc1_._y && !_loc1_.isOver)
{
_loc1_.isOver = true;
snd.play("snd_over");
}
var _loc3_ = _loc1_._parent._parent._parent.effect;
_loc3_.count = _loc3_.count + 1;
_loc1_.count = _loc1_.count + 1;
if(_loc1_.count % 8 == 0)
{
var _loc2_ = _loc3_.attachMovie("smoke","s" add _loc3_.count,_loc3_.count);
_loc2_._x = _loc1_._x;
_loc2_._y = _loc1_._y + (random(10) - 5);
_loc2_._xscale = _loc2_._yscale = random(50) + 50;
}
};
classBike.prototype.check = function(obj)
{
var _loc1_ = this;
var _loc3_ = obj;
var yrange = _loc1_._y - _loc3_._y;
var _loc2_ = undefined;
if(yrange < Math.max(50,(_loc1_.yspeed + Game.speed) * 5))
{
if(_loc3_._x < _loc1_._x)
{
_loc2_ = _loc1_._x - _loc3_._x;
if(_loc2_ < 40)
{
_loc1_._x += _loc1_.xspeed;
}
}
else
{
_loc2_ = _loc3_._x - _loc1_._x;
if(_loc2_ < 40)
{
_loc1_._x -= _loc1_.xspeed;
}
}
}
};